package Frame;

import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener;
import java.awt.event.WindowStateListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.JFrame;
import javax.swing.JRootPane;

import FCRendering.FCRMaster;
import Function.FCSound;

public class FCGameFrame extends JFrame {
	private int winWidth;
	private int winHeight;
	private Image image = Toolkit.getDefaultToolkit().getImage("./material/icon/icon.png");
	private Image cur = Toolkit.getDefaultToolkit().getImage("./material/icon/stick.png");

	public FCGameFrame() {
//		Dimension di = Toolkit.getDefaultToolkit().getScreenSize();
		winWidth =970; //490;//di.width;+10
		winHeight =576; //303;//di.height;+33
	//	winWidth =490;
	//	winHeight =306;
//		winWidth =1930;
//		winHeight =1113;
		setBounds(0, 0, winWidth, winHeight);
		setResizable(false);

//		setLayout(null);
		setTitle("重装机兵 第一代 -- V World Game Studio 版本");
		setIconImage(image);
		setUndecorated(true);//false 就是有拖拉窗口
		getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
		setCursor(Toolkit.getDefaultToolkit().createCustomCursor(cur, new Point(16, 4),"stick"));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLocationRelativeTo(null);
		FCRMaster master = new FCRMaster();
//		master.setBounds(0, 0, winWidth, winHeight);
		this.add(master);
		addComponentListener(new ComponentListener() {
			@Override
			public void componentShown(ComponentEvent e) {}
			@Override
			public void componentResized(ComponentEvent e) {
				int w=getWidth(),h=getHeight();
				if(w!=winWidth && h==winHeight)
					h=(int)(((w-10)/1920.0)*1080)+33;
				else
					w=(int)(((h-33)/1080.0)*1920)+10;
				setSize(w, h);
				winWidth=w;
				winHeight=h;
				setCursor(Toolkit.getDefaultToolkit().createCustomCursor(cur, new Point(16, 4),"stick"));
			}
			@Override
			public void componentMoved(ComponentEvent e) {}
			@Override
			public void componentHidden(ComponentEvent e) {}
		});
		setVisible(true);
	}
}
